package com.mt.mall.dao.User;

import com.mt.common.core.web.base.PageDTO;
import com.mt.common.core.web.base.PageResultDTO;
import com.mt.mall.entity.User.ShippingAddress;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
@Component(value = "shippingAddressDao")
public interface ShippingAddressDao {

    /**
    * 根据分页参数查询收获地址集合
    *
    * @param pageDTO 分页条件
    */
    public List<ShippingAddress> findShippingAddresss(PageDTO pageDTO);

    /**
    * 查询全部收获地址集合
    *
    */
    public List<ShippingAddress> findAllShippingAddresss();

    /**
    * 查询所有收获地址集合(只提取ID 和 Name)
    *
    */
    public List<ShippingAddress> findAllShippingAddresssWithIdName();

    /**
    * 根据名称查询收获地址集合(只提取ID 和 Name)
    *
    * @param shippingAddressName 名称
    */
    public List<ShippingAddress> findShippingAddresssWithIdNameByName(@Param("shippingAddressName") String shippingAddressName);

    /**
    * 根据ID查询指定的收获地址(只提取ID 和 Name)
    *
    * @param shippingAddressId Id
    */
    public ShippingAddress findShippingAddresssWithIdNameById(@Param(" shippingAddressId") Long shippingAddressId);

    /**
    * 根据分页参数查询收获地址集合的数量
    *
    * @param pageDTO 分页条件
    */
    public Long findShippingAddressTotalCount(PageDTO pageDTO);

    /**
    * 根据ID查询指定的收获地址
    *
    * @param shippingAddressId Id
    */
    public ShippingAddress findShippingAddress(@Param("shippingAddressId") Long shippingAddressId);

    /**
    * 根据ID查询指定的收获地址(包含外键)
    *
    * @param shippingAddressId Id
    */
    public ShippingAddress findShippingAddressWithForeignName(@Param("shippingAddressId") Long shippingAddressId);

    /**
    * 新增收获地址
    *
    * @param shippingAddress 实体对象
    */
    public Long saveShippingAddress(ShippingAddress shippingAddress);

    /**
    * 更新收获地址
    *
    * @param shippingAddress 实体对象
    */
    public Long updateShippingAddress(ShippingAddress shippingAddress);

    /**
    * 根据ID删除收获地址
    *
    * @param shippingAddressId ID
    */
    public Long deleteShippingAddress(@Param("shippingAddressId") Long shippingAddressId);

    List<ShippingAddress> findShippingAddressByUserId(@Param("userId") Long userId);

    void setDefaultAddress(ShippingAddress shippingAddress);

    ShippingAddress getDefaultAddress(@Param("userId") Long userId);
}
